
//Symbol('aa')==Symbol('aa')
//利用Symbol值的唯一性，将私有方法的名字命名为一个Symbol值
const _private_name = Symbol('_PIRVATE_NAME_')
const _private_method = Symbol('_PRIVATE_NAME_')

class Ink{
	constructor(name){

		//@私有属性
		this[_private_name] = name
		this.name = "my public name is " + name

		//console.log('Ink is instanced!')
		
	}

	getPrivateName(){
		return this[_private_name]
	}

	[_private_method](){
		console.log('----------------[_private_method]----------------------')
		console.log('this is private method')
		console.log(`my name is ${this[_private_name]}`)
		console.log('-------------------------------------------------------')
	}

	execPrivateMethod(){
		this[_private_method]();
	}

	callPrivateMethod(){
		console.log(getName.call(this));
	}

}

//将私有方法移出模块, 模块内部的所有方法都是对外可见的
function getName(){
	return this.name
}

export default Ink